#light

namespace CGraph.AppGraph

open System.Collections.Generic;

type IRequiredEdge = interface end
    
type IOptionalEdge = interface end

type IProviderEdge = interface end

/// Represents a given named service.  Clients
/// will need to take care of casting the object
/// to the desired representation.  It is wise
/// to append the version of your service to the name,
/// thus forcing clients to query for exactly the
/// object they expect to get.
type IServiceVertex =
    interface CGraph.Generic.INamedObject
    abstract Object : obj with get


/// Passed into the post initialize pass.  Allows access to
/// service objects after the entire graph has completed its
/// initialization.
type IServiceRecord =
    abstract Item : string -> obj with get
    
    
/// Used during initialization of services.  Use this interface
/// to query which services have been registered at this point so
/// you can tailor your service to other available services.
///
/// Finally, you can add a post initialize hook that takes the service
/// record object.  From here it is safe to cache and use service objects
/// because the entire application graph has ran through the initialization
/// process.
type IServiceInit =
    abstract ServiceCreated : string -> bool
    abstract AddInitHook: (IServiceRecord -> unit) ->unit
    abstract AddPostInitHook: (unit -> unit) ->unit

    
type InitializerResult = string * obj
type InitializerCallback = (IServiceInit -> InitializerResult array)
    
type IProviderVertex = 
    interface CGraph.Generic.INamedObject
    abstract Initializer : InitializerCallback with get
    
    
type IAppGraph = interface end
    
    
    